﻿using System;
#region Using statements
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using SmartFrequency.Utils;
#endregion

namespace SmartFrequency.GUI
{
    public partial class FileManagerSettings : Form
    {
        #region Private variables
        private Language FromLanguage;
        private Settings PSettings;
        private Utilities PUtils = new Utilities();
        #endregion

        public FileManagerSettings()
        {
            InitializeComponent();

            this.Text = PUtils.Version;
            PSettings = new Settings("settings.txt");
            PSettings.Load();

            switch (PSettings.GetMember("language"))
            {
                default:
                case "tr":
                case "TR":
                    FromLanguage = new Language(Language.Language_e.TR);
                    label1.Left -= 5;
                    break;
                case "ENG":
                case "eng":
                    FromLanguage = new Language(Language.Language_e.ENG);
                    label1.Left += 5;
                    break;
            }

            label1.Text = FromLanguage.FrmMsgToString(Language.FormMsg_e.FORM7_HEAD);
            label2.Text = FromLanguage.FrmMsgToString(Language.FormMsg_e.FORM7_LABEL2);
            label3.Text = FromLanguage.FrmMsgToString(Language.FormMsg_e.FORM7_LABEL1);

            menuItem2.Text = FromLanguage.FrmMsgToString(Language.FormMsg_e.MENU7_TEXT);
            comboBox1.Text = PSettings.GetMember("dblclkduration");

            if (Convert.ToInt32(PSettings.GetMember("displaydirectories")) == 1)
                checkBox1.Checked = true;
            else
                checkBox1.Checked = false;
        }

        private void menuItem2_Click(object sender, EventArgs e)
        {
            PSettings.SetMember("dblclkduration", comboBox1.Text);
            if (checkBox1.Checked == true)
                PSettings.SetMember("displaydirectories", "1");
            else
                PSettings.SetMember("displaydirectories", "0");
            PSettings.Store();
            Dispose();
        }
    }
}